<!DOCTYPE html>
<html>
<head>
	<title>test</title>
	<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
	<h1>呵呵</h1>
	<h2>哈哈</h2>
</body>
<script type="text/javascript">
	var doc = document.getElementsByTagName('h1')[0];
	doc.onclick = function(){
		console.log(doc);
	}

	var docv = document.getElementsByTagName('h2')[0];
	docv.onclick = function(){
		alert(2);
	}

</script>
</html>